<?php
/**
 * Created by : Sandi Rizky Kharisma (sandi.informatics08@gmail.com)
 * This Class Generated for CRUD purpose only
 */
class m_info_lap_keuangan extends CI_Model
{

    function __construct()
    {
        parent::__construct();
    }
    
    public function get($where = null, $limit = null, $offset = null)
    {
        if($where != null) $this->db->where($where);
        if($limit != null && $offset != null) $this->db->limit($limit, $offset);
        $this->db->order_by('URUT','asc');
        return $this->db->get("info_lap_keuangan");
    }

    function get_all($limit, $uri)
    {

        $result = $this->db->get('info_lap_keuangan', $limit, $uri);
        if ($result->num_rows() > 0)
        {
            return $result->result_array();
        } else
        {
            return array();
        }
    }

    function get_one($id)
    {
        $this->db->where('ID_LAP_KEUANGAN', $id);
        return $this->db->get('info_lap_keuangan');
    }

    function insert()
    {
        $data = array(
                'JENIS' => $this->input->post('JENIS', TRUE),
                'URUT' => $this->input->post('URUT', TRUE),
                'URAIAN_PERKIRAAN' => $this->input->post('URAIAN_PERKIRAAN', TRUE),
                'FORMULASI_PERHITUNGAN' => $this->input->post('FORMULASI_PERHITUNGAN', TRUE),
                'TGL_UPDATE' => date("Y-m-d H:i:s")
        );
        return $this->db->insert('info_lap_keuangan', $data);
    }

    function update($id)
    {
        $data = array(
                'JENIS' => $this->input->post('JENIS', TRUE),
                'URUT' => $this->input->post('URUT', TRUE),
                'URAIAN_PERKIRAAN' => $this->input->post('URAIAN_PERKIRAAN', TRUE),
                'FORMULASI_PERHITUNGAN' => $this->input->post('FORMULASI_PERHITUNGAN', TRUE)
        );

        $this->db->where('ID_LAP_KEUANGAN', $id);
        return $this->db->update('info_lap_keuangan', $data);
    }

    function delete($id)
    {
        $this->db->where('ID_LAP_KEUANGAN', $id);
        $this->db->delete('info_lap_keuangan');
    }

}
?>
